<?php
class A
{
public function blabla($param)
{
echo $param;
}
public function saySomething($param, $callback)
{
echo "Will call callback function: \r\n";
$callback($param);
}
public function saySomethingElse($param)
{
$this->saySomething($param, [$this, 'blabla']);
}
}
$aInstance = new A();
$aInstance->saySomething('hello', [$aInstance, 'blabla']);
echo "\r\n\r\n";
$aInstance->saySomethingElse('world');
1